<template>
  <section class="jumbotron">
    <h3 class="jumbotron-heading">Search Github Users</h3>
    <div>
      <input type="text" placeholder="enter the name you search" v-model.trim="searchName"/>
      <button @click="search">Search</button>
    </div>
  </section>
</template>

<script>
export default {
  name: "Search",
  data(){
      return{
          searchName:'',
      }
  },
  methods:{
      search(){
          const {searchName} = this;
          if(!searchName){
              alert("收索关键字不能为空！");
              return
          }
          this.$bus.$emit('search', searchName);
          this.searchName = '';
      }
  }
};
</script>

<style scoped></style>
